<template>
  <ul class="contact-container">
    <li v-for="item in list" :key="item.id">
      <a :href="item.href">
        <div class="icon" :class="item.type == 'weixin' ? 'weixin' : ''">
          <Icon :type="item.type" />
        </div>
        <span>{{ item.text }}</span>
      </a>
      <div class="pop">
        <img :src="item.img" />
      </div>
    </li>
  </ul>
</template>

<script>
import Icon from "@/components/Icon";
import { mapState } from "vuex";
export default {
  components: { Icon },
  computed: mapState("setting", ["data"]),
  data: () => ({
    list: [
      {
        id: 0,
        text: "github地址",
        type: "github",
        href: "",
        img:
          "http://www.duyiedu.com/source/img/%E5%85%AC%E4%BC%97%E5%8F%B7%E4%BA%8C%E7%BB%B4%E7%A0%81.png",
      },
      {
        id: 1,
        text: "3460797110@qq.com",
        type: "mail",
        href: "mailto:3460797110@qq.com",
        img:
          "http://www.duyiedu.com/source/img/%E5%85%AC%E4%BC%97%E5%8F%B7%E4%BA%8C%E7%BB%B4%E7%A0%81.png",
      },
      {
        id: 2,
        text: "3460797110",
        type: "qq",
        href:
          "tencent://message/?Menu=yes&uin=3263023350&Service=300&sigT=45a1e5847943b64c6ff3990f8a9e644d2b31356cb0b4ac6b24663a3c8dd0f8aa12a595b1714f9d45",
        img:
          "http://www.duyiedu.com/source/img/%E5%85%AC%E4%BC%97%E5%8F%B7%E4%BA%8C%E7%BB%B4%E7%A0%81.png",
      },
      {
        id: 3,
        text: "微信",
        type: "weixin",
        href: "",
        img:
          "http://www.duyiedu.com/source/img/%E5%85%AC%E4%BC%97%E5%8F%B7%E4%BA%8C%E7%BB%B4%E7%A0%81.png",
      },
    ],
  }),
};
</script>

<style lang='less' scoped>
@import "~@/assets/style/var.less";
.contact-container {
  list-style: none;
  padding: 20px;
  margin: 0;
  @itemheight: 30px;
  li {
    height: @itemheight;
    line-height: @itemheight;
    margin: 14px 0;
    cursor: pointer;
    position: relative;

    &:hover {
      .pop {
        transform: scaleY(1);
      }
    }
    .pop {
      position: absolute;
      left: 0;
      bottom: @itemheight + 5px;
      padding: 10px 15px;
      background: #fff;
      border-radius: 5px;
      transform: scaleY(0);
      transform-origin: center bottom;
      transition: transform 0.2s;
      img {
        width: 150px;
        height: 150px;
      }
      &::after {
        content: "";
        position: absolute;
        left: 50%;
        bottom: 0;
        width: 8px;
        height: 8px;
        background: #fff;
        transform: translate(-50%, 50%) rotate(45deg);
      }
    }
  }
  a {
    display: flex;
    align-items: center;
    color: @gray;
    font-size: 14px;
    .icon {
      font-size: 26px;
      width: 36px;
      &.weixin {
        font-size: 32px;
        text-indent: -3px;
      }
    }
  }
}
</style>
